package com.gfm.story.controller;

import com.gfm.story.entity.base.PageBean;
import com.gfm.story.service.story.ReadLogService;
import com.gfm.story.util.ParamUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @BelongsProject: story
 * @BelongsPackage: com.gfm.story.controller
 * @Author: Administrator
 * @CreateTime: 2019-06-06 15:09
 * @Description: ${Description}
 */
@RequestMapping("ReadLog")
@Controller
public class ReadLogController {

    @Resource
    private ReadLogService readLogService;

    @RequestMapping("getReadPage")
    public String getReadPage(HttpServletRequest request,int index, PageBean pageBean, ModelMap modelMap) throws Exception {
        Map<String, Object> map = ParamUtil.getParameterMap(request);
        String date = request.getParameter("date");//榜单类型
        if (date!=null){
            map.put("date",date);
        }
        map.put("start", pageBean.getStart());
        map.put("pageSize", pageBean.getRows());
        modelMap.put("bookList",readLogService.getBookListByDay(map,pageBean.getPage()));
        modelMap.put("index", index);
        return "ph";
    }
}
